package org.dromara.job.snailjob;

import cn.hutool.core.date.DateUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.aizuda.snailjob.client.model.ExecuteResult;
import com.aizuda.snailjob.common.core.util.JsonUtil;
import com.aizuda.snailjob.common.log.SnailJobLog;
import lombok.RequiredArgsConstructor;
import org.dromara.common.outsys.xiong.service.IXiongService;

import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author opensnail
 * @date 2024-05-17
 */
@Component
@JobExecutor(name = "xiongJobExecutor")
@RequiredArgsConstructor
public class XiongDataJob {


    Log log = LogFactory.get();
    private final IXiongService xiongService;



//    Log log = LogFactory.getLog();

    public ExecuteResult jobExecute(JobArgs jobArgs) {


        String dateTime = DateUtil.formatDateTime(new Date());

        log.info(dateTime+"++++++++++++---------");

        xiongService.getFundBaseInfo();

        SnailJobLog.LOCAL.info("开始xiongJob定时任务,参数:{}", JsonUtil.toJsonString(jobArgs));
        SnailJobLog.REMOTE.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
        return ExecuteResult.success("执行成功");
    }
}
